package com.de.demo.client.controller;


import com.de.demo.client.api.UserApi;
import com.de.demo.client.pojo.User;
import com.moon.platform.commons.communication.CommunicationFactory;
import com.moon.platform.commons.communication.SimpleResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
public class UserController {

    @Autowired
    private UserApi userApi;

    @RequestMapping("/demo")
    public Object test(){
        SimpleResponse simpleResponse = CommunicationFactory.createSimpleResponse();
        List<User> users = userApi.qryUserList();
        simpleResponse.addData("list",users);
        return simpleResponse;
    }
}
